//
//  APIManager.h
//  Demo
//
//  Created by 拓客营 on 2022/3/24.
//

#import <Foundation/Foundation.h>
#import <AFNetworking.h>

NS_ASSUME_NONNULL_BEGIN

typedef void (^successAPIBlock)(id responseObject);
typedef void (^failureAPIBlock)(NSError *error);
typedef void (^UploadProgress)(int64_t bytesWritten,
                               int64_t totalBytesWritten);

@interface APIManager : NSObject

+ (instancetype)manager;

@property (nonatomic, copy) NSString *token;



// GET
- (void)Get:(NSString *)URLString parameters:(nullable id)parameters success:(nullable successAPIBlock)success failure:(nullable failureAPIBlock)failure;

// POST
- (void)Post:(NSString *)URLString parameters:(nullable id)parameters success:(nullable successAPIBlock)success failure:(nullable failureAPIBlock)failure;


/// 上传图片
/// @param images           图片数组
/// @param parameters  参数
/// @param success         成功回调
/// @param failure         失败回调
- (void)uploadImages:(NSArray<UIImage *> *)images parameters:(nullable id)parameters success:(successAPIBlock)success failure:(failureAPIBlock)failure;

- (void)uploadSingleImages:(nullable UIImage *)image parameters:(nullable id)parameters success:(successAPIBlock)success failure:(failureAPIBlock)failure;


/// 监听网络状态
- (void)checkAFNReachability:(void (^)(AFNetworkReachabilityStatus status))block;

@end

NS_ASSUME_NONNULL_END
